WORD - Function to use to export PNG

I don't know if I overlooked something or not but how do I export a PNG to a WORD document. In a DOORS module, I have several OLE objects that users created - one OLE object per one DOORS object. For each of the OLE object, I exported it as a PNG image but now I don't know how to insert that image to a WORD document. Does anyone have any clue on how to do this?

Thanks for any input provided.
pete.kowalski - Thu Jan 27 09:44:31 EST 2011

Re: WORD - Function to use to export PNG
Bob_Swan - Thu Jan 27 10:11:29 EST 2011

Word will happily accept png images from the clipboard (manually).
I would therefore expect you can just treat it like any other OLE object.

Re: WORD - Function to use to export PNG
ostanescu - Thu Jan 27 12:31:02 EST 2011

Bob_Swan - Thu Jan 27 10:11:29 EST 2011
Word will happily accept png images from the clipboard (manually).
I would therefore expect you can just treat it like any other OLE object.

I had a few versions of Word exporter.
First one was around copy/paste:

Buffer b = create
b+= richTextWithOle o.”Object Text”
setRichClip(b, NORMAL, FONTABLE) - see DXL help for details
err = oleMethod(oRange, cMethodPaste)

  • this method was using the system clipboard therefore the user cannot do any copy/past while exporting a module to Word, and sometimes the OLE would be bigger that the width of the Word page, and required resizing
Then I re-factored with htmlText function, to export into an intermediary html file:

  • htmlText(tempHtml, o.attr, true, false, "", "", TEMP, exportProgressPoint "")
- tempHtml is a buffer
- o.attr - is the attribute getting exported
- TEMP is a temporary folder
- exportProgressPoint is an increment for each object
- the rest is irrelevant

This function creates html for the text and also tags for images and exports the pictures as 1.png0, 2.png0, 2.png1, etc. in the temp folder
  • then Word can handle html

Octavian

Re: WORD - Function to use to export PNG
pete.kowalski - Thu Feb 10 19:15:06 EST 2011

ostanescu - Thu Jan 27 12:31:02 EST 2011
I had a few versions of Word exporter.
First one was around copy/paste:

Buffer b = create
b+= richTextWithOle o.”Object Text”
setRichClip(b, NORMAL, FONTABLE) - see DXL help for details
err = oleMethod(oRange, cMethodPaste)

  • this method was using the system clipboard therefore the user cannot do any copy/past while exporting a module to Word, and sometimes the OLE would be bigger that the width of the Word page, and required resizing
Then I re-factored with htmlText function, to export into an intermediary html file:

  • htmlText(tempHtml, o.attr, true, false, "", "", TEMP, exportProgressPoint "")
- tempHtml is a buffer
- o.attr - is the attribute getting exported
- TEMP is a temporary folder
- exportProgressPoint is an increment for each object
- the rest is irrelevant

This function creates html for the text and also tags for images and exports the pictures as 1.png0, 2.png0, 2.png1, etc. in the temp folder
  • then Word can handle html

Octavian

Thanks ostanescu for your suggestions and sample code. I will study these and see if I can figure this out.